"""day1 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,re_path
from django.views.static import serve
from django.conf import settings
from app02.views import depart,pttary,form_s,user,admins,account,order,charts,upload,city

urlpatterns = [
    # path('admin/', admin.site.urls),
    re_path(r'^media/(?P<path>.*)$',serve,{'document_root':settings.MEDIA_ROOT},name='media'),
    #部门管理
    path('depart/list/',depart.depart_list),
    path('depart/add/',depart.depart_add),
    path('depart/delete/',depart.depart_delete),
    path('depart/<int:nid>/edit/',depart.depart_edit),
    path('depart/upload/',depart.depart_upload),

    #用户管理
    path('user/list/',user.user_list),
    path('user/add/',user.user_add),
    path('user/delete/',user.user_delete),
    path('user/<int:nid>/edit/',user.user_edit),

    #from表单
    path('login/',form_s.login_form),

    #ModelForm表单 新建用户
    path( 'user/model/form/add/', user.user_model_form_add),
    #ModelForm表单 编辑用户
    path('user/model/<int:nid>/edit/',user.user_model_edit),

    #靓号管理
    path('pttary/list/',pttary.pttary_list),
    path('pttary/add/',pttary.pttary_add),
    path('pttary/<int:uid>/edit/',pttary.pttary_edit),
    path('pttary/<int:uid>/delete/',pttary.pttary_delete),

    #管理员账户
    path('admins/list/',admins.admin_list),
    path('admins/add/',admins.admin_add),
    path('admins/<int:nid>/edit/', admins.admin_edit),
    path('admins/<int:nid>/delete/', admins.admin_delete),
    path('admins/<int:nid>/reset/', admins.admin_reset),

    #用户登录
    path('login/dl/',account.login),
    path('logout/',account.logout),
    path('image/code/',account.image_code),

    #订单管理
    path('order/list/',order.order_list),
    path('order/add/',order.order_add),
    path('order/delete/',order.order_delete),
    path('order/deatil/',order.order_deatil),
    path('order/edit/',order.order_edit),

    #数据统计
    path('charts/list/',charts.chart_list),
    path('charts/bar/',charts.chart_bar),
    path('charts/pie/',charts.chart_pie),
    path('charts/line/',charts.chart_line),

    #文件上传
    path('upload/list/',upload.upload_list),
    path('upload/form/',upload.upload_form),
    path('upload/model/form/',upload.upload_model_form),
    # path('upload/image/',upload.upload_image)

    #城市列表
    path('city/list/',city.city_list),
    path('city/add/',city.city_add),
    path('city/<int:nid>/edit/',city.city_edit),
    path('city/<int:nid>/delete/',city.city_delete)

]